<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">

    <style>
        .main {
            width: 500px;
            height: 500px;
            background-color: red;
        }
        
        .main .father {
            width: 400px;
            height: 400px;
        }
        
        .main .fater .son {
            width: 200px;
            height: 200px;
        }
    </style>
</head>

<body>
    <div class="main">
        <div class="father">

            <div class="son">
                <a href="">链接</a>
            </div>
        </div>

    </div>

    <script>
        var main = document.querySelector(".main");
        main.onclick = function() {
            console.log(1)
        }
    </script>
</body>

</html>